package com.bwda.dsrs.filecenter.mapper.dsrs;

import com.bwda.dsrs.filecenter.domain.po.executionpolicy.ExecutionPolicyPo;
import com.bwda.dsrs.filecenter.domain.condition.executionpolicy.ExecutionPolicyCondition;
import com.bwda.dsrs.filecenter.domain.po.executionpolicy.TaskDbGroupPo;
import feign.Param;

import java.util.List;

/**
 * @author Administrator
 */
public interface ExecutionPolicyMapper extends BaseMapper<ExecutionPolicyPo, ExecutionPolicyCondition> {
    /**
     * 启用停用任务
     *
     * @param po 策略任务对象
     */
    void setTaskStatus(ExecutionPolicyPo po);


    /**
     * 删除策略任务
     *
     * @param executionPolicyIds 策略任务IDS
     */
    void deleteByIds(@Param("executionPolicyIds") Long[] executionPolicyIds);


    /**
     * Gets task db group by task id *
     *
     * @param executionPolicyIds execution policy ids
     * @return the task db group by task id
     */
    List<TaskDbGroupPo> getTaskDbGroupByTaskId(@Param("executionPolicyIds") Long[] executionPolicyIds);

    /**
     * 删除策略任务关联资源范围表
     *
     * @param auditTaskIds 策略任务IDS
     */
    void deleteResAuditTaskResourceScope(@Param("auditTaskIds") Long[] auditTaskIds);

    /**
     * 新增策略任务关联资源范围表
     *
     * @param poList 策略任务关联资源范围对象
     */
    void addBatchResAuditTaskResourceScope(@Param("poList") List<TaskDbGroupPo> poList);

    /**
     * 根据任务id查询任务详情
     *
     * @param taskIds 策略任务IDS
     * @return list
     */
    List<ExecutionPolicyPo> queryResAuditTaskTypeListByTaskId(@Param("taskIds") Long[] taskIds);


    /**
     * 获取状态为启用的所有任务列表
     *
     * @return list
     */
    List<ExecutionPolicyPo> selectResCanRunAuditTaskCnfg();

    /**
     * 更新任务的最后一次执行时间
     *
     * @param executionPolicyId 任务ID
     * @param lastExecutionTime 最后一次执行时间
     * @return
     */
    void updateTaskExecutionTime(@Param("executionPolicyId") Long executionPolicyId, @Param("lastExecutionTime") String lastExecutionTime);

    /**
     * Count res audit task cnfg by task name int
     *
     * @param executionPolicyName 策略名称
     * @param createUserCode      用户code
     * @param executionPolicyId   execution policy id
     * @return int
     */
    int countResAuditTaskCnfgByTaskName(ExecutionPolicyPo po);
}